import Vue from 'vue'
import myloding from '@/components/myloding/myloding'

const createloding = Vue.extend(myloding)
const instance = new createloding({
    el: document.createElement('div')
})
instance.show = false
const $loding = {
    show({ msg, src }) {
        instance.show = true
        instance.msg = msg
        instance.src = src
        document.body.appendChild(instance.$el)
    },
    hide() {
        instance.show = false
    }
}
export default {
    install() {
        if (!Vue.$loding) {
            Vue.$loding = $loding
        }
        Vue.mixin({
            created() {
                this.$loding = Vue.$loding
            }
        })
    }
}